package com.igoal.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class UserCategoryPk implements Serializable{
	private static final long serialVersionUID = -2192985974033933590L;
	
	private Category category;
	private User user;
	@ManyToOne
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	@ManyToOne
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
 
        UserCategoryPk that = (UserCategoryPk) o;
 
        if (category != null ? !category.equals(that.category) : that.category != null) return false;
        if (user != null ? !user.equals(that.user) : that.user != null) return false;
 
        return true;
	}
	@Override
	public int hashCode() {
		return category.hashCode()+user.hashCode();
	}
}
